-
-
Notifications
You must be signed in to change notification settings - Fork 881
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mock facter version based on puppet version & unit tests: print puppet/facter version #1355
Conversation
@@ -42,6 +42,18 @@ | |||
end | |||
|
|||
RSpec.configure do |c| | |||
# getting the correct facter version is tricky. We use facterdb as a source to mock facts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you going to submit this to modulesync as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course. I just need to test it here.
Getting the correct facter version is tricky. We use facterdb as a source to mock facts see https://github.com/camptocamp/facterdb. People might provide a specific facter version. In that case we use it. Otherwise we need to match the correct facter version to the used puppet version. As of 2019-10-31, puppet 5 ships facter 3.11 and puppet 6 ships facter 3.14 (see https://puppet.com/docs/puppet/5.5/about_agent.html). This was tested at voxpupuli/puppet-nginx#1355
c.default_facter_version = if ENV['FACTERDB_FACTS_VERSION'] | ||
ENV['FACTERDB_FACTS_VERSION'] | ||
else | ||
Gem::Dependency.new('', ENV['PUPPET_VERSION']).match?('', '5') ? '3.11.0' : '3.14.0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In theory, 3.11
and 3.14
(without the .0
) would work now. But that's not important.
Getting the correct facter version is tricky. We use facterdb as a source to mock facts see https://github.com/camptocamp/facterdb. People might provide a specific facter version. In that case we use it. Otherwise we need to match the correct facter version to the used puppet version. As of 2019-10-31, puppet 5 ships facter 3.11 and puppet 6 ships facter 3.14 (see https://puppet.com/docs/puppet/5.5/about_agent.html). This was tested at voxpupuli/puppet-nginx#1355
Mock facter version based on puppet version & unit tests: print puppet/facter version
Getting the correct facter version is tricky. We use facterdb as a source to mock facts see https://github.com/camptocamp/facterdb. People might provide a specific facter version. In that case we use it. Otherwise we need to match the correct facter version to the used puppet version. As of 2019-10-31, puppet 5 ships facter 3.11 and puppet 6 ships facter 3.14 (see https://puppet.com/docs/puppet/5.5/about_agent.html).